package lims.cloud.system.dictionary;

import lims.cloud.system.base.mybatis.IBaseControllerImpl;
import lims.cloud.system.base.mybatis.Result;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/system/dictionary")
public class DictionaryController extends IBaseControllerImpl<Dictionary, DictionaryService> {
    private final DictionaryService dictionaryService;

    public DictionaryController(DictionaryService baseService, DictionaryService dictionaryService) {
        super(baseService);
        this.dictionaryService = dictionaryService;
    }

    @PutMapping("/{id}/direction/{direction}")
    public Result<Dictionary> changeSequence(@PathVariable Long id, @PathVariable String direction) {
        return dictionaryService.changeSequence(id, direction);
    }

    @GetMapping("/maxSequence/{typeText}")
    public Result<Integer> getMaxSequence(@PathVariable String typeText) {
        return dictionaryService.getMaxSequence(typeText);
    }
}